﻿using Company.Database.Entities;

namespace Company.Database.Sqlite
{
    public class AlarmRepository : RepositoryBase ,IAlarmRepository
    {
        public bool Delete(AlarmEntity entity)
        {
            db.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Deleted;
            return db.SaveChanges() > 0;
        }

        public List<AlarmEntity> GetAll()
        {
            return db.Alarms.ToList();
        }

        public bool Insert(AlarmEntity entity)
        {
            db.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Added;
            return db.SaveChanges() > 0;
        }

        public bool Update(AlarmEntity entity)
        {
            db.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            return db.SaveChanges() > 0;
        }
    }
}
